package com.kingkim.electromechanical;

import com.kingkim.electromechanical.commonutils.util.FormTokenInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
@MapperScan("com.kingkim.electromechanical.*.mapper")
@SpringBootApplication
public class ElectromechanicalApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ElectromechanicalApplication.class);
    }
    public static void main(String[] args) {
        SpringApplication.run(ElectromechanicalApplication.class, args);
    }

    /**
     * 配置拦截器
     * @author Zhang XuHui
     * @param registry
     */
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new FormTokenInterceptor()).addPathPatterns("/**");
    }


}
